<% include common/header.html %>
<div class="main" style="padding:20px 0;">
    <h2><center>模板引擎功能演示</center></h2>
    <h6>if else 语句</h6>
    <% var a='12'%>
    <p><%=a%></p>
    <%if(a=='12'){%>
    <p>a=='12'</p>
    <% } else {%>
    <p>a!='12'</p>
    <% } %>
    <hr />
    
    <h6>switch case 语句</h6>
    <% var a=12;%>
    <% switch(a){
        case 12:%>
        <p>a ==12</p>
        <% break; %>
        <% case 13: %>
        <p>a == 13</p>
        <% break; %>
        <% default: %>
        <p>I don't know</p>
        <% break; %>
    <% } %>
    <hr />
    
    <h6>列表遍历 forEach语句</h6>
    <% var list = [
        {name:"john",gender:"male",age:29},
        {name:"lily",gender:"female",age:26},
        {name:"robert",gender:"male",age:35}
    ]%>
    <%if (list && list.length){%>
        <ol>
            <% list.forEach(function(item,index){%>
                <li><%=item.name%>--<%=item.gender%>--<%=item.age%></li>
            <%})%>
        </ol>
    <%} else{%>
    <div>暂无数据</div>
    <%}%>


    

<div>
<% include common/footer.html %>